/* Version definitions */
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WIN8
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WIN8

#include <ntifs.h>
#include <ndk/ntndk.h>

#define C_ASSERT_FIELD(Type, Offset, MemberType, MemberName) \
    C_ASSERT(FIELD_OFFSET(Type, MemberName) == Offset); \
    C_ASSERT(FIELD_SIZE(Type, MemberName) == sizeof(MemberType));

/* KTHREAD */
C_ASSERT_FIELD(KTHREAD, 0x000, DISPATCHER_HEADER, Header)
C_ASSERT_FIELD(KTHREAD, 0x010, PVOID, SListFaultAddress)
C_ASSERT_FIELD(KTHREAD, 0x018, ULONG64, QuantumTarget)
C_ASSERT_FIELD(KTHREAD, 0x020, PVOID, InitialStack)
C_ASSERT_FIELD(KTHREAD, 0x024, PVOID, StackLimit)
C_ASSERT_FIELD(KTHREAD, 0x028, PVOID, StackBase)
C_ASSERT_FIELD(KTHREAD, 0x02C, ULONG, ThreadLock)
C_ASSERT_FIELD(KTHREAD, 0x030, ULONG64, CycleTime)
C_ASSERT_FIELD(KTHREAD, 0x038, ULONG, HighCycleTime)
C_ASSERT_FIELD(KTHREAD, 0x03C, PVOID, ServiceTable)
C_ASSERT_FIELD(KTHREAD, 0x040, ULONG, CurrentRunTime)
C_ASSERT_FIELD(KTHREAD, 0x044, ULONG, ExpectedRunTime)
C_ASSERT_FIELD(KTHREAD, 0x048, PVOID, KernelStack)
C_ASSERT_FIELD(KTHREAD, 0x04C, PXSAVE_FORMAT, StateSaveArea)
C_ASSERT_FIELD(KTHREAD, 0x050, struct _KSCHEDULING_GROUP*, SchedulingGroup)
C_ASSERT_FIELD(KTHREAD, 0x054, KWAIT_STATUS_REGISTER, WaitRegister)
C_ASSERT_FIELD(KTHREAD, 0x055, UCHAR, Running)
C_ASSERT_FIELD(KTHREAD, 0x056, UCHAR[2], Alerted)
C_ASSERT_FIELD(KTHREAD, 0x058, LONG, MiscFlags)
C_ASSERT_FIELD(KTHREAD, 0x05C, LONG, ThreadFlags)
C_ASSERT_FIELD(KTHREAD, 0x060, ULONG, Spare0)
C_ASSERT_FIELD(KTHREAD, 0x064, ULONG, SystemCallNumber)
C_ASSERT_FIELD(KTHREAD, 0x068, PVOID, FirstArgument)
C_ASSERT_FIELD(KTHREAD, 0x06C, PKTRAP_FRAME, TrapFrame)
C_ASSERT_FIELD(KTHREAD, 0x070, KAPC_STATE, ApcState)
C_ASSERT_FIELD(KTHREAD, 0x087, CHAR, Priority)
C_ASSERT_FIELD(KTHREAD, 0x088, ULONG, UserIdealProcessor)
C_ASSERT_FIELD(KTHREAD, 0x08C, ULONG, ContextSwitches)
C_ASSERT_FIELD(KTHREAD, 0x090, UCHAR, State)
C_ASSERT_FIELD(KTHREAD, 0x091, CHAR, NpxState)
C_ASSERT_FIELD(KTHREAD, 0x092, UCHAR, WaitIrql)
C_ASSERT_FIELD(KTHREAD, 0x093, CHAR, WaitMode)
C_ASSERT_FIELD(KTHREAD, 0x094, LONG, WaitStatus)
C_ASSERT_FIELD(KTHREAD, 0x098, PKWAIT_BLOCK, WaitBlockList)
C_ASSERT_FIELD(KTHREAD, 0x09C, LIST_ENTRY, WaitListEntry)
C_ASSERT_FIELD(KTHREAD, 0x09C, SINGLE_LIST_ENTRY, SwapListEntry)
C_ASSERT_FIELD(KTHREAD, 0x0A4, PKQUEUE, Queue)
C_ASSERT_FIELD(KTHREAD, 0x0A8, PVOID, Teb)
C_ASSERT_FIELD(KTHREAD, 0x0B0, ULONG64, RelativeTimerBias)
C_ASSERT_FIELD(KTHREAD, 0x0B8, KTIMER, Timer)
C_ASSERT_FIELD(KTHREAD, 0x0E0, KWAIT_BLOCK[4], WaitBlock)
C_ASSERT_FIELD(KTHREAD, 0x0F4, PKTHREAD_COUNTERS, ThreadCounters)
C_ASSERT_FIELD(KTHREAD, 0x10C, PXSTATE_SAVE, XStateSave)
C_ASSERT_FIELD(KTHREAD, 0x124, PVOID, Win32Thread)
C_ASSERT_FIELD(KTHREAD, 0x138, ULONG, WaitTime)
C_ASSERT_FIELD(KTHREAD, 0x13C, SHORT, KernelApcDisable)
C_ASSERT_FIELD(KTHREAD, 0x13E, SHORT, SpecialApcDisable)
C_ASSERT_FIELD(KTHREAD, 0x13C, ULONG, CombinedApcDisable)
C_ASSERT_FIELD(KTHREAD, 0x140, LIST_ENTRY, QueueListEntry)
C_ASSERT_FIELD(KTHREAD, 0x148, ULONG, NextProcessor)
C_ASSERT_FIELD(KTHREAD, 0x14C, ULONG, DeferredProcessor)
C_ASSERT_FIELD(KTHREAD, 0x150, PKPROCESS, Process)
C_ASSERT_FIELD(KTHREAD, 0x154, GROUP_AFFINITY, UserAffinity)
C_ASSERT_FIELD(KTHREAD, 0x15A, CHAR, PreviousMode)
C_ASSERT_FIELD(KTHREAD, 0x15B, CHAR, BasePriority)
C_ASSERT_FIELD(KTHREAD, 0x15C, CHAR, PriorityDecrement)
C_ASSERT_FIELD(KTHREAD, 0x15D, UCHAR, Preempted)
C_ASSERT_FIELD(KTHREAD, 0x15E, UCHAR, AdjustReason)
C_ASSERT_FIELD(KTHREAD, 0x15F, CHAR, AdjustIncrement)
C_ASSERT_FIELD(KTHREAD, 0x160, GROUP_AFFINITY, Affinity)
C_ASSERT_FIELD(KTHREAD, 0x166, UCHAR, ApcStateIndex)
C_ASSERT_FIELD(KTHREAD, 0x167, UCHAR, WaitBlockCount)
C_ASSERT_FIELD(KTHREAD, 0x168, ULONG, IdealProcessor)
C_ASSERT_FIELD(KTHREAD, 0x174, KAPC_STATE, SavedApcState)
C_ASSERT_FIELD(KTHREAD, 0x18B, UCHAR, WaitReason)
C_ASSERT_FIELD(KTHREAD, 0x18C, CHAR, SuspendCount)
C_ASSERT_FIELD(KTHREAD, 0x18D, CHAR, Saturation)
C_ASSERT_FIELD(KTHREAD, 0x18E, USHORT, SListFaultCount)
C_ASSERT_FIELD(KTHREAD, 0x190, KAPC, SchedulerApc)
C_ASSERT_FIELD(KTHREAD, 0x191, UCHAR, ResourceIndex)
C_ASSERT_FIELD(KTHREAD, 0x193, UCHAR, QuantumReset)
C_ASSERT_FIELD(KTHREAD, 0x194, ULONG, KernelTime)
C_ASSERT_FIELD(KTHREAD, 0x1B4, PKPRCB, WaitPrcb)
C_ASSERT_FIELD(KTHREAD, 0x1B8, PVOID, LegoData)
C_ASSERT_FIELD(KTHREAD, 0x1BF, UCHAR, CallbackNestingLevel)
C_ASSERT_FIELD(KTHREAD, 0x1C0, ULONG, UserTime)
C_ASSERT_FIELD(KTHREAD, 0x1C4, KEVENT, SuspendEvent)
C_ASSERT_FIELD(KTHREAD, 0x1D4, LIST_ENTRY, ThreadListEntry)
C_ASSERT_FIELD(KTHREAD, 0x1DC, LIST_ENTRY, MutantListHead)
